import 'package:flutter/material.dart';

class HexColor extends Color {
  static int _getColorFromHex(String? hexColor) {
    if (hexColor != null) {
      hexColor = hexColor.toUpperCase().replaceAll("#", "");
      if (hexColor.length == 6) {
        hexColor = "FF" + hexColor;
      } else {
        hexColor = "FF" + "808080";
      }
      return int.parse(hexColor, radix: 16);
    } else {
      return 0x808080;
    }
  }
  HexColor(final String? hexColor) : super(_getColorFromHex(hexColor));
}